package com.zzty.txj1.service.impl;

import com.zzty.txj1.dao.QuestionDao;
import com.zzty.txj1.dao.QuestionMapper;
import com.zzty.txj1.dao.TeamExamDao;
import com.zzty.txj1.entity.Question;
import com.zzty.txj1.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl implements QuestionService {
    @Autowired
    QuestionMapper questionMapper;

    @Autowired
    QuestionDao questionDao;

    @Autowired
    TeamExamDao teamExamDao;


    @Override
    public Integer addQuestion(String content) {
        Integer count = questionMapper.insertContent(content);
        return count;
    }

    @Override
    public List<Question> getAllQuestion() {
        List<Question> questions = questionMapper.getAllQuestion();
        return questions;
    }

    @Override
    public Question getQuestionById(Integer id) {
        Question question = questionMapper.getQuestionById(id);
        return question;
    }

    @Override
    public List<Question> getQuestion() {
        List<Question> questions = questionDao.getQuestion();
        return questions;
    }

    @Override
    public Integer getQuestionCount() {
        Integer count = questionDao.getQuestionCount();
        return count;
    }

    @Override
    public Integer addQuestion(Question question) {
        Integer count = questionDao.addQuestion(question);
        return count;
    }

    @Override
    public Question addContent(Question question) {
        Question question1 = question;
        questionDao.addContent(question1);
        return question1;
    }


    @Override
    public String getContentById(Question question) {
        System.out.println("333");
        String content = "";
        content = questionDao.getContentById(question);
        System.out.println("content is :" + content);
        return content;
    }

    @Override
    public Question getQuestionById(Question question) {
        Question question1=questionDao.getQuestionById(question);
        return question1;
    }

    @Override
    public Integer getMaxQuestionId() {
        Integer questionId=questionDao.getMaxQuestionId();
        return questionId;
    }


}